From 8d9254f862917c936cf6a76fafd66c76f3c14d2d Mon Sep 17 00:00:00 2001 From: Tim Deegan Date: Sat, 20 Jan 2007 11:40:52 +0000 Subject: [PATCH] [HVM] Save/restore cleanups 06: Let dom0 change domU's paging mode Signed-off-by: Zhai Edwin Signed-off-by: Tim Deegan --- xen/arch/x86/mm/shadow/common.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index b821222634..d1f4ffa18c 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2569,12 +2569,15 @@ static void sh_update_paging_modes(struct vcpu *v) /* Need to make a new monitor table for the new mode */ mfn_t new_mfn, old_mfn; - if ( v != current ) + if ( v != current && vcpu_runnable(v) ) { SHADOW_ERROR("Some third party (d=%u v=%u) is changing " - "this HVM vcpu's (d=%u v=%u) paging mode!\n", - current->domain->domain_id, current->vcpu_id, - v->domain->domain_id, v->vcpu_id); + "this HVM vcpu's (d=%u v=%u) paging mode " + "while it is running.\n", + current->domain->domain_id, current->vcpu_id, + v->domain->domain_id, v->vcpu_id); + /* It's not safe to do that because we can't change + * the host CR£ for a running domain */ domain_crash(v->domain); return; } @@ -2590,7 +2593,8 @@ static void sh_update_paging_modes(struct vcpu *v) * pull it down! Switch CR3, and warn the HVM code that * its host cr3 has changed. */ make_cr3(v, mfn_x(new_mfn)); - write_ptbase(v); + if ( v == current ) + write_ptbase(v); hvm_update_host_cr3(v); old_mode->destroy_monitor_table(v, old_mfn); } -- 2.30.2